using System.Runtime.InteropServices;

namespace ServiceUtilities
{
    /// <summary>
    /// Struct required to set shutdown privileges 
    /// </summary>
    /// <remarks>
    /// The Pack attribute specified here is important. We are in essence cheating here because the Privileges field is
    /// actually a variable size array of structs.  We use the Pack=1 to align the Privileges
    /// field exactly after the PrivilegeCount field when marshalling this struct to Win32. 
    /// </remarks>
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct TokenPrivileges
    {
        public int PrivilegeCount;
        public LuidAndAttributes Privileges;

        [StructLayout(LayoutKind.Sequential)]
        public struct LuidAndAttributes
        {
            public long Luid;
            public int Attributes;
        }

    }
}